package com.sinodata.bsm.cicp.collector.network;

import com.sinodata.bsm.cicp.cache.CacheFactory;
import com.sinodata.bsm.cicp.cache.NetWorkCache;
import com.sinodata.bsm.cicp.collector.Collector;

/**
 * <p>
 * Description: 
 * </p>
 *
 * @author wangpeng
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2013-10-9 下午3:45:22          wangpeng        1.0         To create
 * </p>
 *
 * @since 
 * @see     
 */
public abstract class NetWorkCollector extends Collector {
    protected final static int retries = 0;
    protected final static long timeout = 5000;
    private final static NetWorkCache netWorkCache = (NetWorkCache) CacheFactory.getCache(NetWorkCache.class);

    /**
     * 
     * @param sysoid
     *            系统oid
     * @param type
     *            采集的资源类型：1为cpu，2为内存
     * @return
     */
    protected String getOidBySysoid(String sysoid, int type) {
        if (sysoid != null && !sysoid.startsWith(".")) {
            sysoid = "." + sysoid;
        }
        String oid = null;
        switch (type) {
            case 1:
                oid = netWorkCache.getCpuOid(sysoid);
                break;
            case 2:
                oid = netWorkCache.getMemOid(sysoid);
                break;
        }
        return oid;
    }
}
